﻿using System;
using System.Collections.Generic;
using System.Text;
using MTG.DTO.GameCollections;
using MTG.DTO;
using NUnit.Framework;

namespace MTG.Tests.DTO
{
    [TestFixture]
    public class DTOTests
    {
        [Test]
        public void Hand_Should_Be_Able_To_Add_1_Cards()
        {
            IGameCollection hand = new Hand();
            hand.Add(new Card("Shivan Dragon", new Guid(), CardType.Sorcery, CardRarity.Rare));
            Assert.AreEqual(1, hand.List.Count, "should have returned 1 card in hand");
        }

        [Test]
        public void Hand_Should_Be_One_And_Of_Name_Shivan_Dragon()
        {
            IGameCollection hand = new Hand();
            hand.Add(new Card("Shivan Dragon", new Guid(), CardType.Creature, CardRarity.Rare));
            Assert.AreEqual(1, hand.List.Count, "count should be one");
            Assert.AreEqual("Shivan Dragon", hand.List[0].CardName, "card name should be Shivan Dragon");
        }

        [Test]
        public void Hand_Should_Be_Of_Enumerated_Type_Creature()
        {
            IGameCollection hand = new Hand();
            hand.Add(new Card("Shivan Dragon", new Guid(), CardType.Creature, CardRarity.Rare));
            Assert.AreEqual(CardType.Creature, hand.List[0].CardType, "Card type should be creature");
        }

        [Test]
        public void Hand_Should_Be_Of_Type_Rare()
        {
            IGameCollection hand = new Hand();
            hand.Add(new Card("Shivan Dragon", new Guid(), CardType.Creature, CardRarity.Rare));
            Assert.AreEqual(CardType.Creature, hand.List[0].CardType, "Card type should be creature");
            Assert.AreEqual(CardRarity.Rare, hand.List[0].CardRarity, "should be rare");
        }

        [Test]
        public void Hand_Should_Be_Able_To_Have_A_Card_Removed()
        {
            IGameCollection hand = new Hand();
            hand.Add(new Card("Shivan Dragon", new Guid(), CardType.Creature, CardRarity.Rare));
            hand.Add(new Card("Shivan Dragon", new Guid(), CardType.Creature, CardRarity.Rare));
            hand.Add(new Card("Shivan Dragon", new Guid(), CardType.Creature, CardRarity.Rare));
            Assert.AreEqual(3, hand.List.Count, "should be three cards in hand");
            hand.Remove(0);
            Assert.AreEqual(2, hand.List.Count, "should be two now");
        }
        [Test]
        public void Hand_Should_Be_Able_To_Return_A_Card_At_Random()
        {
            IGameCollection hand = new Hand();
            hand.Add(new Card("Shivan Dragon", new Guid(), CardType.Creature, CardRarity.Rare));
            hand.Add(new Card("Shivan Dragon", new Guid(), CardType.Creature, CardRarity.Rare));
            hand.Add(new Card("Shivan Dragon", new Guid(), CardType.Creature, CardRarity.Rare));
            ICard card = hand.ReturnRandom();
            Assert.AreEqual(2, hand.List.Count, "should return a random card");
        }
    }
}